<!-- 购物车 -->
<template>
  <van-tabs :active="active" @click-tab="onClickTab" sticky>
    <van-tab title="待我处理" :name="ApproveTypeEnum.UNDO">
      <ApproveUndoList :type="loadType" :key="ApproveTypeEnum.UNDO" />
    </van-tab>
    <van-tab title="我已处理" :name="ApproveTypeEnum.DONE">
      <ApproveDoneList :type="loadType" :key="ApproveTypeEnum.DONE" />
    </van-tab>
    <van-tab title="我发起的" :name="ApproveTypeEnum.SUBMIT">
      <ApproveSubmitList :type="loadType" :key="ApproveTypeEnum.SUBMIT" />
    </van-tab>
    <van-tab title="抄送我的" :name="ApproveTypeEnum.CC">
      <ApproveCcmeList :type="loadType" :key="ApproveTypeEnum.CC" />
    </van-tab>
  </van-tabs>
</template>

<script setup lang="ts">
  import { ref } from 'vue';
  import { onLoad } from '@dcloudio/uni-app';
  import { ApproveTypeEnum } from '../../enums/approveEnum';
  import { isNotEmpty } from '../../utils/is';

  const active = ref(ApproveTypeEnum.UNDO);
  const loadType = ref(ApproveTypeEnum.UNDO); //默认加载待我处理
  //tab 点击事件
  const onClickTab = (item: any) => {
    active.value = item.name;
    loadType.value = item.name;
  };
  onLoad((option) => {
    //从首页调转，获取要加载的页签类型
    if (isNotEmpty(option)) {
      loadType.value = option?.approveType;
      active.value = loadType.value;
    }
  });
</script>
<style scoped lang="scss">
  .card-title {
    color: #000000;
    font-weight: 600;
  }

  .status {
    color: #56b77a;
    font-weight: 600;
  }
</style>
